-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visual referee update: Free kick signal detection #1646
base: main
Are you sure you want to change the base?
Conversation
02fbf70
to
f24baba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review not yet complete
crates/bevyhavior_simulator/src/bin/visual_referee_free_kick_behavior.rs
Outdated
Show resolved
Hide resolved
@@ -325,6 +326,7 @@ impl GameState { | |||
)] | |||
pub enum Team { | |||
Hulks, | |||
#[default] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should Team::Opponent
be default? I don't think it is a good idea to add this default impl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. I only did this, because our implementation of PathDeserialize
for Option<T>
requires Default
and I changed the kicking_team
to a Option<Team>
. I don't think there is another way to specialize the implementation of PathDeserialize
specifically for Option<Team>
... Dunno what else to do :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm yes you are right about that. You can still do a manual implementation of PathDeserialize
when Team
does not implement Default
. @schmidma I am a bit confused that PathDeserialize
for Option<T>
requires T: Default
. Looking at the code It looks like a totally different value is deserialized in the None
case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not manage to manually implement PathDeserialize
for Option<Team>
, since adding spl_network_messages
, which defines Team
, as a dependency to the path_serde
crate, creates a cyclic dependency 🫠.
I now simply removed the requirement for the Default
derive for Option<T>
by just not deserializing in the None
case. This should be fine, since the value is a None
anyway, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on what you mean by "fine". It changes the behavior.
If the previous value was none, we'd construct a default one and recurse with the deserialization.
That was a design decision we made at some point, though I'm not sure we depend on this behavior anywhere currently.
3eb1e77
to
8788ae5
Compare
crates/control/src/behavior/node.rs
Outdated
.filter_map(|(player_number, penalty)| { | ||
penalty.is_none().then_some(player_number) | ||
}) | ||
.skip(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the keeper is penalized? If 1 is penalized and rest of the team is not, 3 & 4 would be selected instead of 2 & 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intentional. The lowest non-penalized player number, in this case 2, is chosen as replacement keeper, which should not look for the referee, imo.
dfe36ac
to
6fbfb8d
Compare
Co-authored-by: MaikRe <[email protected]>
Co-authored-by: MaikRe <[email protected]>
Co-authored-by: MaikRe <[email protected]>
Co-authored-by: MaikRe <[email protected]>
6fbfb8d
to
a165dd4
Compare
Why? What?
The rule update for the 2025 season introduces a change to the set play of free kicks. Instead of sending the kicking team in the game controller message during all free kicks, now, during
CornerKick
,GoalKick
,KickIn
, andPushingFreeKick
no kicking team will be sent in the game controller message. Instead, the head referee will give a visual signal to indicate the direction of play for the kicking team. This means a signal in the direction of the goal of the HULKs indicates that the Opponent is the kicking team. This signal can be seen below:This expands our current visual referee implementation to now also detect this free kick visual referee signal.
We only try to detect the visual referee signal in
KickIn
andPushingFreeKick
, since thekicking_team
duringCornerKick
andGoalKick
can be deduced from the current ball position and the teamsGlobalFieldSide
, i.e. whether their are home or away. DuringKickIn
andPushingFreeKick
, whenHome
theDefenderRight
andMidfielderRight
should look at the referee and do the detection. WhenAway
, this is done byDefenderLeft
andMidfielderLeft
and the first two non-penalized Searchers that are not the keeper.This PR only implements the detection of the signal. It does not yet apply the detection to the
kicking_team
in theFilteredGameControllerState
,since the game controller currently still always sends the kicking team, as it has not been updated yet (see RoboCup-SPL/GameController3)(EDIT: It has been updated).Fixes #1476
ToDo / Known Issues
Ideas for Next Iterations (Not This PR)
How to Test
CornerKick
,GoalKick
,KickIn
, andPushingFreeKick
.KickIn
andPushingFreeKick
only the correct defender and midfielder or searcher look at the referee and do the visual signal detection.